package com.yj.provider.validator;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class MyValidator implements ConstraintValidator<CheckLength,String> {
    private int min;

    @Override
    public void initialize(CheckLength constraintAnnotation) {
        min = constraintAnnotation.min();
    }

    @Override
    public boolean isValid(String str, ConstraintValidatorContext constraintValidatorContext) {

        if (str.length()> min){
            return true;
        }

        return false;
    }
}
